*//////////////////////////////////////////////////////////////////////////////
*                                                                             /         
*				High-Pressure, High-Paying Jobs?                              /
*               The Review of Economics and Statistics                        /
*                                                                             /
*               Authors: Markus Nagler, Johannes Rincke, Erwin Winkler        /
*                                                                             /
*               Do-File 3: Analysis of observational data                     /
*                                                                             /
*               This file generates:                                          /
*               - Figures 1 panel (a),A1,A2,A4,A5,A8                          /
*               - Tables 1,2,A2,A3,A4,A5,A6                                   /
*                                                                             /
*                                                                             /
*//////////////////////////////////////////////////////////////////////////////



use "$data\bibb_2018_processed.dta", replace

global ext_mincer "high_edu med_edu age age2 age3 female german i.nuts2 d_bik_* grade_*"
global occ_ind "d_occ2d_* d_ind_*"
global firm_empl "works_council temp_agency commute temp_contract firmsize2 firmsize3 firmsize4 firmsize5 normal_workhours shift standby number_sub"
global tasks "d_routine d_codifiable computer phys_index"






*//////////////////////////////////////////////////////////////////////////////
*                                                                             /
*                        Figure 1, panel (a)                                  /
*                        Link between pressure and health                     /
*                                                                             /
*//////////////////////////////////////////////////////////////////////////////

{
preserve

quietly{
local x pressure

local i=0

gen b=.
gen se=.
gen counter=.
gen yvar=""
gen split=""

local i=`i'+1
reg nosleep `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 20 in `i'

local i=`i'+1
reg tired `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 19 in `i'

local i=`i'+1
reg nervous `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 18 in `i'

local i=`i'+1
reg exhausted_mental `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 17 in `i'

local i=`i'+1
reg exhausted_phys `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 16 in `i'

local i=`i'+1
reg d_taxing `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 15 in `i'

local i=`i'+1
reg d_relax `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 14 in `i'

local i=`i'+1
reg toomuchwork `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 13 in `i'

local i=`i'+1
reg stress_increase `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 12 in `i'

local i=`i'+1
reg d_limit `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 11 in `i'



keep b se counter 
drop if b==.

gen upper = b + 1.96*se
gen lower = b - 1.96*se
gen significant = upper<0 | lower>0 | upper>0
replace lower=. if upper==.
}


twoway (rcap upper lower counter , horizontal color(black))  ///
(scatter counter b if significant==1 , color(black) msymbol(dh) ) ///
(scatter counter b if significant==0 , color(black) msymbol(dh)) ///
, ytitle("") legend(off) ///
xline(0, lpattern(dash)) ///
xline(0.05, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.1, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.15, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.2, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.25, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.3, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.35, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.4, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.45, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.5, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
ylabel(20 "Sleep problems" 19 "Tired" 18 "Nervous" 17 "Mentally exhausted" 16 "Physically exhausted" 15 "Work emotionally taxing" 14 "Hard to relax after work" 13 "Overwhelmed by too much work" 12 "Stress has increased over past two years" 11 "Reaches personal limit often", angle(0)  labsize(medium)) xtitle(Coefficient of pressure index)  ysize(4)  yscale(range(10 21)) xscale(range(0 0.5)  titlegap(4))  xsize(6) xlabel(0(0.05)0.5)   graphregion(margin(large)) scale(0.9) 


restore
}






*///////////////////////////////////////////////////////////////////////////////
*                                                                              /
*                   Table 1                                                    /
*                   High-pressure jobs: Earnings, wages, and work hours        /
*                                                                              /
*///////////////////////////////////////////////////////////////////////////////

* Panel (a): Log monthly earnings

qui reg ln_income pressure $ext_mincer $occ_ind $firm_empl $tasks, vce(cluster occ)

quietly{	
reg ln_income pressure [pw=weight] if e(sample)==1, vce(cluster occ)
estimates store r1
estadd ysumm

reg ln_income pressure $ext_mincer [pw=weight], vce(cluster occ)
estimates store r2
estadd ysumm

reg ln_income pressure $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
estimates store r3
estadd ysumm

reg ln_income pressure $ext_mincer $occ_ind $firm_empl [pw=weight], vce(cluster occ)
estimates store r4
estadd ysumm

reg ln_income pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
estimates store r5
estadd ysumm

}


estout  r1 r2 r3 r4 r5, cells(b(fmt(2) star) se(fmt(2) par))  stats(r2_a N, fmt(%9.2f %18.0g) labels(`"Adj. R2"' `"Obs."')) ///
starlevels(`"\sym{*}"' 0.10 `"\sym{**}"' 0.05 `"\sym{***}"' 0.01, label(" \(p<@\)")) delimiter(&) end(\\) ///
prefoot("\hline") label mlabels(none) nonumbers collabels(none) keep(pressure) order (treatment ) eqlabels("", begin("\hline" "") nofirst) notype ///
level(95) style(esttab)  replace




* Panel (b): Log hours

qui reg ln_hours pressure $ext_mincer $occ_ind $firm_empl $tasks, vce(cluster occ)

quietly{	
reg ln_hours pressure [pw=weight] if e(sample)==1, vce(cluster occ)
estimates store r1
estadd ysumm

reg ln_hours pressure $ext_mincer [pw=weight], vce(cluster occ)
estimates store r2
estadd ysumm

reg ln_hours pressure $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
estimates store r3
estadd ysumm

reg ln_hours pressure $ext_mincer $occ_ind $firm_empl [pw=weight], vce(cluster occ)
estimates store r4
estadd ysumm

reg ln_hours pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
estimates store r5
estadd ysumm

}


estout  r1 r2 r3 r4 r5, cells(b(fmt(2) star) se(fmt(2) par))  stats(r2_a N, fmt(%9.2f %18.0g) labels(`"Adj. R2"' `"Obs."')) ///
starlevels(`"\sym{*}"' 0.10 `"\sym{**}"' 0.05 `"\sym{***}"' 0.01, label(" \(p<@\)")) delimiter(&) end(\\) ///
prefoot("\hline") label mlabels(none) nonumbers collabels(none) keep(pressure) order (treatment ) eqlabels("", begin("\hline" "") nofirst) notype ///
level(95) style(esttab)  replace




* Panel (c): Log hourly wage

qui reg ln_hours pressure $ext_mincer $occ_ind $firm_empl $tasks, vce(cluster occ)

quietly{	
reg ln_wage pressure [pw=weight] if e(sample)==1, vce(cluster occ)
estimates store r1
estadd ysumm

reg ln_wage pressure $ext_mincer [pw=weight], vce(cluster occ)
estimates store r2
estadd ysumm

reg ln_wage pressure $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
estimates store r3
estadd ysumm

reg ln_wage pressure $ext_mincer $occ_ind $firm_empl [pw=weight], vce(cluster occ)
estimates store r4
estadd ysumm

reg ln_wage pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
estimates store r5
estadd ysumm

}


estout  r1 r2 r3 r4 r5, cells(b(fmt(2) star) se(fmt(2) par))  stats(r2_a N, fmt(%9.2f %18.0g) labels(`"Adj. R2"' `"Obs."')) ///
starlevels(`"\sym{*}"' 0.10 `"\sym{**}"' 0.05 `"\sym{***}"' 0.01, label(" \(p<@\)")) delimiter(&) end(\\) ///
prefoot("\hline") label mlabels(none) nonumbers collabels(none) keep(pressure) order (treatment ) eqlabels("", begin("\hline" "") nofirst) notype ///
level(95) style(esttab)  replace







*///////////////////////////////////////////////////////////////////////////////
*                                                                              /
*                         Table 2                                              /
*                         Placebo, civil servants                              /
*                                                                              /
*///////////////////////////////////////////////////////////////////////////////



use "$data\bibb_2018_processed_placebo.dta", replace

global ext_mincer "high_edu med_edu age age2 age3 female german i.nuts2 d_bik_* grade_*"
global occ_ind "d_occ2d_* d_ind_*"
global firm_empl "works_council temp_agency commute temp_contract firmsize2 firmsize3 firmsize4 firmsize5 normal_workhours shift standby number_sub"
global tasks "d_routine d_codifiable computer phys_index"



* Panel (a): Log monthly earnings

qui reg ln_income pressure $ext_mincer $occ_ind $firm_empl $tasks, vce(cluster occ)

quietly{	
reg ln_income pressure [pw=weight] if e(sample)==1, vce(cluster occ)
estimates store r1
estadd ysumm

reg ln_income pressure $ext_mincer [pw=weight], vce(cluster occ)
estimates store r2
estadd ysumm

reg ln_income pressure $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
estimates store r3
estadd ysumm

reg ln_income pressure $ext_mincer $occ_ind $firm_empl [pw=weight], vce(cluster occ)
estimates store r4
estadd ysumm

reg ln_income pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
estimates store r5
estadd ysumm

}


estout  r1 r2 r3 r4 r5, cells(b(fmt(2) star) se(fmt(2) par))  stats(r2_a N, fmt(%9.2f %18.0g) labels(`"Adj. R2"' `"Obs."')) ///
starlevels(`"\sym{*}"' 0.10 `"\sym{**}"' 0.05 `"\sym{***}"' 0.01, label(" \(p<@\)")) delimiter(&) end(\\) ///
prefoot("\hline") label mlabels(none) nonumbers collabels(none) keep(pressure) order (treatment ) eqlabels("", begin("\hline" "") nofirst) notype ///
level(95) style(esttab)  replace




* Panel (b): Log hours

qui reg ln_hours pressure $ext_mincer $occ_ind $firm_empl $tasks, vce(cluster occ)

quietly{	
reg ln_hours pressure [pw=weight] if e(sample)==1, vce(cluster occ)
estimates store r1
estadd ysumm

reg ln_hours pressure $ext_mincer [pw=weight], vce(cluster occ)
estimates store r2
estadd ysumm

reg ln_hours pressure $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
estimates store r3
estadd ysumm

reg ln_hours pressure $ext_mincer $occ_ind $firm_empl [pw=weight], vce(cluster occ)
estimates store r4
estadd ysumm

reg ln_hours pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
estimates store r5
estadd ysumm

}


estout  r1 r2 r3 r4 r5, cells(b(fmt(2) star) se(fmt(2) par))  stats(r2_a N, fmt(%9.2f %18.0g) labels(`"Adj. R2"' `"Obs."')) ///
starlevels(`"\sym{*}"' 0.10 `"\sym{**}"' 0.05 `"\sym{***}"' 0.01, label(" \(p<@\)")) delimiter(&) end(\\) ///
prefoot("\hline") label mlabels(none) nonumbers collabels(none) keep(pressure) order (treatment ) eqlabels("", begin("\hline" "") nofirst) notype ///
level(95) style(esttab)  replace




* Panel (c): Log hourly wage

qui reg ln_wage pressure $ext_mincer $occ_ind $firm_empl $tasks, vce(cluster occ)

quietly{	
reg ln_wage pressure [pw=weight] if e(sample)==1, vce(cluster occ)
estimates store r1
estadd ysumm

reg ln_wage pressure $ext_mincer [pw=weight], vce(cluster occ)
estimates store r2
estadd ysumm

reg ln_wage pressure $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
estimates store r3
estadd ysumm

reg ln_wage pressure $ext_mincer $occ_ind $firm_empl [pw=weight], vce(cluster occ)
estimates store r4
estadd ysumm

reg ln_wage pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
estimates store r5
estadd ysumm

}


estout  r1 r2 r3 r4 r5, cells(b(fmt(2) star) se(fmt(2) par))  stats(r2_a N, fmt(%9.2f %18.0g) labels(`"Adj. R2"' `"Obs."')) ///
starlevels(`"\sym{*}"' 0.10 `"\sym{**}"' 0.05 `"\sym{***}"' 0.01, label(" \(p<@\)")) delimiter(&) end(\\) ///
prefoot("\hline") label mlabels(none) nonumbers collabels(none) keep(pressure) order (treatment ) eqlabels("", begin("\hline" "") nofirst) notype ///
level(95) style(esttab)  replace












*//////////////////////////////////////////////////////////////////////////////
*                                                                             /
*                     APPENDIX TABLES AND FIGURES                             /
*                                                                             /
*//////////////////////////////////////////////////////////////////////////////




*///////////////////////////////////////////////////////////////////////////////
*                                                                              /
*                         Table A.2                                            /
*                         Principle component analysis of pressure             /
*                                                                              /
*///////////////////////////////////////////////////////////////////////////////

use "$data\bibb_2018_processed.dta", replace


{
preserve

foreach y in deadlines multitasking minimum interrupt fast{
recode `y' (4=1) (3=2) (2=3) (1=4)
}

pca deadlines multitasking minimum interrupt, vce(normal) 

restore
}






*///////////////////////////////////////////////////////////////////////////////
*                                                                              /
*                         Figure A.1                                           /
*                         Alternative definitions of work pressure             /
*                                                                              /
*///////////////////////////////////////////////////////////////////////////////

{
preserve

foreach y in deadlines multitasking minimum interrupt fast{
recode `y' (4=1) (3=2) (2=3) (1=4)
}

pca deadlines multitasking minimum interrupt 
predict pressure_pca 

pca deadlines multitasking 
predict pressure2_pca 

pca deadlines multitasking interrupt 
predict pressure3_pca 

pca deadlines multitasking minimum interrupt fast
predict pressure5_pca 


foreach y in pressure_pca pressure2_pca pressure3_pca pressure5_pca{
sum `y' 
replace `y' = (`y'-r(mean))/r(sd)
} 

corr pressure pressure_pca 


quietly{
local y ln_income

local i=0

gen b=.
gen se=.
gen counter=.
gen yvar=""
gen split=""


local i=`i'+1
reg `y' pressure2 $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[pressure2] in `i'
replace se = _se[pressure2] in `i'

replace counter = 17 in `i'



local i=`i'+1
reg `y' pressure3 $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[pressure3] in `i'
replace se = _se[pressure3] in `i'

replace counter = 16 in `i'



local i=`i'+1
reg `y' pressure $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 15 in `i'


local i=`i'+1
reg `y' pressure5 $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[pressure5] in `i'
replace se = _se[pressure5] in `i'

replace counter = 14 in `i'



local i=`i'+1
reg `y' pressure2_pca $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[pressure2_pca] in `i'
replace se = _se[pressure2_pca] in `i'

replace counter = 11 in `i'



local i=`i'+1
reg `y' pressure3_pca $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[pressure3_pca] in `i'
replace se = _se[pressure3_pca] in `i'

replace counter = 10 in `i'


local i=`i'+1
reg `y' pressure_pca $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[pressure_pca] in `i'
replace se = _se[pressure_pca] in `i'

replace counter = 9 in `i'



local i=`i'+1
reg `y' pressure5_pca $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[pressure5_pca] in `i'
replace se = _se[pressure5_pca] in `i'

replace counter = 8 in `i'






keep b se counter 
drop if b==.

gen upper = b + 1.96*se
gen lower = b - 1.96*se
gen significant = upper<0 | lower>0 | upper>0
replace lower=. if upper==.
}


twoway (rcap upper lower counter , horizontal color(edkblue))  ///
(scatter counter b if significant==1 , color(red) msymbol(d) ) ///
(scatter counter b if significant==0 , color(edkblue) msymbol(dh)) ///
, ytitle("") legend(off) ///
xline(0, lpattern(dash)) ///
xline(2, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(4, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(6, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(8, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(10, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(12, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(14, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(16, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(18, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(20, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(22, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
ylabel(18 "{bf:Ad hoc measures}" 17 "Deadlines + Multitasking " 16 "+ Interruptions" 15 "+ Min. requirements (= Baseline)" 14 "+ Working fast" 12 "{bf:PCA-based measures (standardized)}" 11 "Deadlines + Multitasking" 10 "+ Interruptions" 9 "+ Min. requirements" 8 "+ Working fast", angle(0)  labsize(medium)) xtitle(Coefficient of pressure index)  ysize(4)  yscale(range(7 19)) xscale(range(0 22)  titlegap(4))  xsize(6) xlabel(0(2)22)   graphregion(margin(large)) scale(0.9) 



restore
}






*///////////////////////////////////////////////////////////////////////////////
*                                                                              /
*                         Table A.3                                            /
*                         Disamenities related to pressure                     /
*                                                                              /
*///////////////////////////////////////////////////////////////////////////////


quietly{
gen jobhappiness_index=job_unhappy+worktime_unhappy+pay_unhappy+boss_unhappy+promotion_unhappy+ training_unhappy+workplacemood_unhappy
gen health_index= nosleep +tired +nervous+ exhausted_mental+ exhausted_phys +d_taxing +d_relax+ toomuchwork+ d_limit  
 gen family_index= married + kid 
 
 foreach x in jobhappiness_index health_index  family_index{
 sum `x' [aw=weight]
 local av=r(mean)
 local std=r(sd)
 replace `x'=(`x'-`av')/`std'
 }
 
 local x pressure
 local i=0 
 reg sickdays `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
 
  sum sickdays,d
 local w=r(p95)
 replace sickdays=`w' if sickdays>`w' & sickdays!=.
 
foreach y in health_index sickdays jobhappiness_index jobchange married nofamily_time {
local i=`i'+1
reg `y' `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
estimates store r`i'
estadd ysumm
}
}

estout  r1 r2 r3 r4 r5 r6, cells(b(fmt(2) star) se(fmt(2) par))  stats(ymean r2_a N, fmt(%9.2f %9.2f %18.0g) labels(`"Mean dep."' `"Adj. R2"' `"Obs."')) ///
starlevels(`"\sym{*}"' 0.10 `"\sym{**}"' 0.05 `"\sym{***}"' 0.01, label(" \(p<@\)")) delimiter(&) end(\\) ///
prefoot("\hline") label mlabels(none) nonumbers collabels(none) keep(`x') order (treatment ) eqlabels("", begin("\hline" "") nofirst) notype ///
level(95) style(esttab)  replace










*//////////////////////////////////////////////////////////////////////////////
*                                                                             /                 
*                  Figure A.2                                                 /
*                  Link between pressure and job satisfaction                 /
*                                                                             /
*//////////////////////////////////////////////////////////////////////////////

{
preserve

quietly{
local x pressure

local i=0

gen b=.
gen se=.
gen counter=.
gen yvar=""
gen split=""

local i=`i'+1
reg job_unhappy `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 20 in `i'

local i=`i'+1
reg worktime_unhappy `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 19 in `i'

local i=`i'+1
reg pay_unhappy `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 18 in `i'

local i=`i'+1
reg boss_unhappy `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 17 in `i'

local i=`i'+1
reg promotion_unhappy `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 16 in `i'

local i=`i'+1
reg training_unhappy `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 15 in `i'

local i=`i'+1
reg workplacemood_unhappy `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 14 in `i'


local i=`i'+1
reg jobchange `x' $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
replace b = _b[`x'] in `i'
replace se = _se[`x'] in `i'

replace counter = 13 in `i'




keep b se counter 
drop if b==.

gen upper = b + 1.96*se
gen lower = b - 1.96*se
gen significant = upper<0 | lower>0 | upper>0
replace lower=. if upper==.
}


twoway (rcap upper lower counter , horizontal color(edkblue))  ///
(scatter counter b if significant==1 , color(red) msymbol(d) ) ///
(scatter counter b if significant==0 , color(edkblue) msymbol(dh)) ///
, ytitle("") legend(off) ///
xline(0, lpattern(dash)) ///
xline(0.05, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.1, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.15, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.2, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.25, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.3, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
ylabel(20 "Unhappy with job" 19 "Unhappy with work time" 18 "Unhappy with pay" 17 "Unhappy with boss" 16 "Unhappy with promotion opportunities" 15 "Unhappy with training opportunities" 14 "Unhappy with workplace mood" 13 "Would like to change jobs", angle(0)  labsize(medium)) xtitle(Coefficient of pressure index)  ysize(4)  yscale(range(12 21)) xscale(range(0 0.3)  titlegap(4))  xsize(6) xlabel(0(0.05)0.3)   graphregion(margin(large)) scale(0.9) 



restore
}





*///////////////////////////////////////////////////////////////////////////////
*                                                                              /             
*                           Table A.4                                          /
*                           Predictors of high-pressure jobs                   /
*                                                                              /
*///////////////////////////////////////////////////////////////////////////////


{
local y pressure

reg pressure  $ext_mincer [pw=weight], vce(cluster occ)
estimates store r2
estadd ysumm

reg pressure $ext_mincer $occ_ind [pw=weight], vce(cluster occ)
estimates store r3
estadd ysumm

reg pressure  $ext_mincer $occ_ind $firm_empl  [pw=weight], vce(cluster occ)
estimates store r4
estadd ysumm

reg pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
estimates store r5
estadd ysumm



estout r2 r3 r4 r5, cells(b(fmt(2) star) se(fmt(2) par))  stats(ymean r2_a N, fmt(%9.2f %9.2f %18.0g) labels(`"Mean dep."' `"Adj. R2"' `"Obs."')) ///
starlevels(`"\sym{*}"' 0.10 `"\sym{**}"' 0.05 `"\sym{***}"' 0.01, label(" \(p<@\)")) delimiter(&) end(\\) ///
prefoot("\hline") label mlabels(none) nonumbers collabels(none) keep(high_edu med_edu age female $firm_empl $tasks ) order (treatment ) eqlabels("", begin("\hline" "") nofirst) notype ///
level(95) style(esttab)  replace


}






*///////////////////////////////////////////////////////////////////////////////
*                                                                              /                
*                Table A.5                                                     /
*                High pressure index by 3-digit occupation groups              /
*                                                                              /
*///////////////////////////////////////////////////////////////////////////////
    
{
local occ occ_3d 
                        
preserve

collapse (mean) pressure income high_edu (count) year [aw=weight], by(`occ')
rename year obs
sum obs, d
gen ln_income = ln(income)
drop if obs<20


* Ranking of occupation groups by high pressure index (>=20 obs)
format `occ' %50.0g
gsort -pressure
gen ranking=_n
drop if _n>5
decode `occ' , g(occupation)
keep occupation pressure
replace pressure=round(pressure,0.001)
list occupation pressure

restore

preserve
quietly{
collapse (mean) pressure income high_edu (count) year [aw=weight], by(`occ')
rename year obs
gen ln_income = ln(income)
drop if obs<20
}

* Ranking of occupation groups by high pressure index (>=20 obs)
format `occ' %50.0g
sort pressure
gen ranking=_n
drop if _n>5
decode `occ' , g(occupation)
keep occupation pressure
replace pressure=round(pressure,0.001)
list occupation pressure

restore

}







*///////////////////////////////////////////////////////////////////////////////
*                                                                              /            
*                    Figure A.4                                                /
*                    High pressure: job characteristics                        /
*                                                                              /
*///////////////////////////////////////////////////////////////////////////////

{
preserve

quietly{
local i=0

gen b=.
gen se=.
gen counter=.

local i=`i'+1
reg upper_level pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 20 in `i'

local i=`i'+1
reg team_leader pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 19 in `i'

local i=`i'+1
reg budget pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 18 in `i'

local i=`i'+1
reg rare_praise pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 17 in `i'

local i=`i'+1
reg not_informed pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 16 in `i'




keep b se counter 
drop if b==.

gen upper = b + 1.96*se
gen lower = b - 1.96*se
gen significant = upper<0 | lower>0
replace lower=. if upper==.
}


 twoway (rcap upper lower counter, horizontal color(edkblue))  (scatter counter b if significant==1, color(red) msymbol(d) ) (scatter counter b if significant==0, color(edkblue) msymbol(dh)), ytitle("") legend(off) ///
xline(0, lpattern(dash)) ///
xline(0.1, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.2, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.3, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.4, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
 ylabel(20 "Worker is in upper level of hierarchy" 19 "Worker is team leader"  18 "Worker has budget responsibility" 17 "Worker rarely gets positive feedback" 16 "Freq. not informed about imp. decisions", angle(0)      )   ysize(6)  yscale(range(15 21)) xscale(range(0 0.4)) xlabel(0(0.1)0.4) graphregion(margin(large)) scale(0.7) 

restore
}







*///////////////////////////////////////////////////////////////////////////////
*                                                                              /             
*                     Figure A.5                                               /
*                     High pressure: firm characteristics                      /
*                                                                              /
*///////////////////////////////////////////////////////////////////////////////

{
preserve
local i=0

gen b=.
gen se=.
gen counter=.

local i=`i'+1
reg expansion pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 20 in `i'

local i=`i'+1
reg outs pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 19 in `i'

local i=`i'+1
reg shrink pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 18 in `i'

local i=`i'+1
reg new_prodtech pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 17 in `i'

local i=`i'+1
reg new_computer pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 16 in `i'



keep b se counter 
drop if b==.

gen upper = b + 1.96*se
gen lower = b - 1.96*se
gen significant = upper<0 | lower>0
replace lower=. if upper==.



 twoway (rcap upper lower counter, horizontal color(edkblue))  (scatter counter b if significant==1, color(red) msymbol(d) ) (scatter counter b if significant==0, color(edkblue) msymbol(dh)), ytitle("") legend(off) ///
xline(0, lpattern(dash)) ///
xline(0.1, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.2, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(0.3, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
 ylabel(20 "Firm recently expanded" 19 "Firm recently outsourced workers"  18 "Firm recently let go workers" 17 "Firm introduced new production technologies" 16 "Firm introduced new computer programs", angle(0)      )   ysize(6)  yscale(range(15 21)) xscale(range(0 0.3)) xlabel(0(0.1)0.3) graphregion(margin(large)) scale(0.7) 

restore
}






*///////////////////////////////////////////////////////////////////////////////
*                                                                              /
*                         Figure A.8                                           /
*                         Wage premium heterogeneities                         /
*                                                                              /
*///////////////////////////////////////////////////////////////////////////////


{
preserve

quietly{
local i=0
local y ln_income

gen b=.
gen se=.
gen counter=.

sum age, d
gen high_age=(age>r(p50) & age!=.)


local i=`i'+1
reg ln_income pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight] if high_age==1, vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 20 in `i'

local i=`i'+1
reg ln_income pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight] if high_age==0, vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 19 in `i'

local i=`i'+1
reg ln_income pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight] if female==1, vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 17 in `i'

local i=`i'+1
reg ln_income pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight] if female==0, vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 16 in `i'

local i=`i'+1
reg ln_income pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight] if high_edu==1, vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 14 in `i'

local i=`i'+1
reg ln_income pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight] if high_edu==0, vce(cluster occ)
replace b = _b[pressure] in `i'
replace se = _se[pressure] in `i'

replace counter = 13 in `i'



keep b se counter 
drop if b==.

gen upper = b + 1.96*se
gen lower = b - 1.96*se
gen significant = upper<0 | lower>0
replace lower=. if upper==.
}



 twoway (rcap upper lower counter , horizontal color(edkblue))  (scatter counter b if significant==1 , color(red) msymbol(d) ) (scatter counter b if significant==0 , color(edkblue) msymbol(dh)), ytitle("") legend(off) ///
xline(0, lpattern(dash)) ///
xline(5, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(10, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(15, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
xline(20, lpattern(dash) lcolor(gs13) lwidth(vthin)) ///
ylabel(20 "Above median age" 19 "Below median age" 17 "Females" 16 "Males" 14 "High education" 13 "Low/Medium education", angle(0)  labsize(large)   )   ysize(4)  yscale(range(12 21))  xscale(range(0 20)  titlegap(4))  xsize(6) xlabel(0(5)20)   graphregion(margin(large)) scale(0.9)  

restore
}







*///////////////////////////////////////////////////////////////////////////////
*                                                                              /
*                          Table A.6                                           /
*                          Wage differentials with 3-digit occ. FE             /
*                                                                              /
*///////////////////////////////////////////////////////////////////////////////


global occ_ind "d_occ3d_* d_ind_*"

*Panel (a) Log monthly earnings

qui reg ln_income pressure $ext_mincer $occ_ind $firm_empl $tasks, vce(cluster occ_3d)

quietly{	
reg ln_income pressure [pw=weight] if e(sample)==1, vce(cluster occ_3d)
estimates store r1
estadd ysumm

reg ln_income pressure $ext_mincer [pw=weight], vce(cluster occ_3d)
estimates store r2
estadd ysumm

reg ln_income pressure $ext_mincer $occ_ind [pw=weight], vce(cluster occ_3d)
estimates store r3
estadd ysumm

reg ln_income pressure $ext_mincer $occ_ind $firm_empl [pw=weight], vce(cluster occ_3d)
estimates store r4
estadd ysumm

reg ln_income pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ_3d)
estimates store r5
estadd ysumm

}


estout  r1 r2 r3 r4 r5, cells(b(fmt(2) star) se(fmt(2) par))  stats(r2_a N, fmt(%9.2f %18.0g) labels(`"Adj. R2"' `"Obs."')) ///
starlevels(`"\sym{*}"' 0.10 `"\sym{**}"' 0.05 `"\sym{***}"' 0.01, label(" \(p<@\)")) delimiter(&) end(\\) ///
prefoot("\hline") label mlabels(none) nonumbers collabels(none) keep(pressure) order (treatment ) eqlabels("", begin("\hline" "") nofirst) notype ///
level(95) style(esttab)  replace




* Panel (b): Log hours

qui reg ln_hours pressure $ext_mincer $occ_ind $firm_empl $tasks, vce(cluster occ_3d)

quietly{	
reg ln_hours pressure [pw=weight] if e(sample)==1, vce(cluster occ_3d)
estimates store r1
estadd ysumm

reg ln_hours pressure $ext_mincer [pw=weight], vce(cluster occ_3d)
estimates store r2
estadd ysumm

reg ln_hours pressure $ext_mincer $occ_ind [pw=weight], vce(cluster occ_3d)
estimates store r3
estadd ysumm

reg ln_hours pressure $ext_mincer $occ_ind $firm_empl [pw=weight], vce(cluster occ_3d)
estimates store r4
estadd ysumm

reg ln_hours pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ_3d)
estimates store r5
estadd ysumm

}


estout  r1 r2 r3 r4 r5, cells(b(fmt(2) star) se(fmt(2) par))  stats(r2_a N, fmt(%9.2f %18.0g) labels(`"Adj. R2"' `"Obs."')) ///
starlevels(`"\sym{*}"' 0.10 `"\sym{**}"' 0.05 `"\sym{***}"' 0.01, label(" \(p<@\)")) delimiter(&) end(\\) ///
prefoot("\hline") label mlabels(none) nonumbers collabels(none) keep(pressure) order (treatment ) eqlabels("", begin("\hline" "") nofirst) notype ///
level(95) style(esttab)  replace




* Panel (c): Log hourly wage

qui reg ln_wage pressure $ext_mincer $occ_ind $firm_empl $tasks, vce(cluster occ_3d)

quietly{	
reg ln_wage pressure [pw=weight] if e(sample)==1, vce(cluster occ_3d)
estimates store r1
estadd ysumm

reg ln_wage pressure $ext_mincer [pw=weight], vce(cluster occ_3d)
estimates store r2
estadd ysumm

reg ln_wage pressure $ext_mincer $occ_ind [pw=weight], vce(cluster occ_3d)
estimates store r3
estadd ysumm

reg ln_wage pressure $ext_mincer $occ_ind $firm_empl [pw=weight], vce(cluster occ_3d)
estimates store r4
estadd ysumm

reg ln_wage pressure $ext_mincer $occ_ind $firm_empl $tasks [pw=weight], vce(cluster occ_3d)
estimates store r5
estadd ysumm

}


estout  r1 r2 r3 r4 r5, cells(b(fmt(2) star) se(fmt(2) par))  stats(r2_a N, fmt(%9.2f %18.0g) labels(`"Adj. R2"' `"Obs."')) ///
starlevels(`"\sym{*}"' 0.10 `"\sym{**}"' 0.05 `"\sym{***}"' 0.01, label(" \(p<@\)")) delimiter(&) end(\\) ///
prefoot("\hline") label mlabels(none) nonumbers collabels(none) keep(pressure) order (treatment ) eqlabels("", begin("\hline" "") nofirst) notype ///
level(95) style(esttab)  replace












